<include file="Index:header" />
<div class="panel panel-primary" style="float:left;width:18%;height:620px">
    <div class="panel-heading">导航条</div>
    <div class="panel-body">
        <ul class="nav nav-pills nav-stacked" role="tablist">
            <li role="presentation"><a href="__APP__/Student/profile">个人中心</a></li>
            <li role="presentation"><a href="__APP__/TeachReview/reviewlist">教学评价</a></li>
            <li role="presentation" class="active"><a href="__APP__/Student/passwd">修改密码</a></li>
            <li role="presentation"><a href="__APP__/Public/loginout">退出系统</a></li>
        </ul>
    </div>
</div>
<div class="panel panel-primary" style="float:left;width:81%;margin-left:1%;height:620px">
    <div class="panel-heading">
        <h3 class="panel-title">修改密码</h3>
    </div>
    <div class="panel-body">
        <div class="form-group has-success">
            <label class="control-label" for="inputSuccess1">新密码</label>
            <input type="password" class="form-control new-passwd">
        </div>
        <div class="form-group has-success">
            <label class="control-label" for="inputSuccess1">确认密码</label>
            <input type="password" class="form-control confim-new-passwd">
        </div>
        <button  class="btn btn-default login_button">确认修改</button>
    </div>
</div>
<script>
    $(function () {
        $(".login_button").click(function () {
            var new_passwd = $(".new-passwd").val();
            var confim_new_passwd = $(".confim-new-passwd").val();
            if(!new_passwd&&!confim_new_passwd){
                alert("不准为空");
                return;
            }
            if(new_passwd=="123456"){
                alert("密码设置过于简单，请重新设置");
                return;
            }
            if(new_passwd!==confim_new_passwd){
                 alert("两次输入密码不相同");
                 return;
            }
            var param = {};
            param["new_passwd"] = new_passwd;
            $.post("index.php?s=/Student/updatepasswd",param,function(data){
                if(data.success==true){
                    alert("密码修改成功");
                    window.location.href = "index.php?s=/Public/loginout";
                }else{
                     alert(data.message);
                }
            });
        })
    })

</script>
<include file="Index:footer" />
